home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Delphi Informant Complete 1995 - 2000
/
Delphi Informant Complete 1995 to 2000.iso
/
Delphi Informant Magazine Complete Works SOURCE CODE 1998.rar
/
1998
/
Feb
/
di9802dm
/
ActiveForm
/
AFEmployeeImp.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1997-08-12
|
8KB
|
337 lines
unit AFEmployeeImp;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ActiveX, AxCtrls, EmpForm_TLB, StdCtrls, Db, DBTables, ExtCtrls, DBCtrls,
Grids, DBGrids;
type
TAFEmployee = class(TActiveForm, IAFEmployee)
DBGrid1: TDBGrid;
DBNavigator1: TDBNavigator;
dsEmployee: TDataSource;
tblEmployee: TTable;
lblSearch: TLabel;
edSearch: TEdit;
btnSearch: TButton;
procedure btnSearchClick(Sender: TObject);
private
{ Private declarations }
FEvents: IAFEmployeeEvents;
procedure ActivateEvent(Sender: TObject);
procedure ClickEvent(Sender: TObject);
procedure CreateEvent(Sender: TObject);
procedure DblClickEvent(Sender: TObject);
procedure DeactivateEvent(Sender: TObject);
procedure DestroyEvent(Sender: TObject);
procedure KeyPressEvent(Sender: TObject; var Key: Char);
procedure PaintEvent(Sender: TObject);
protected
{ Protected declarations }
procedure EventSinkChanged(const EventSink: IUnknown); override;
procedure Initialize; override;
function Get_Active: WordBool; safecall;
function Get_AutoScroll: WordBool; safecall;
function Get_AxBorderStyle: TxActiveFormBorderStyle; safecall;
function Get_Caption: WideString; safecall;
function Get_Color: TColor; safecall;
function Get_Cursor: Smallint; safecall;
function Get_DropTarget: WordBool; safecall;
function Get_Enabled: WordBool; safecall;
function Get_Font: Font; safecall;
function Get_HelpFile: WideString; safecall;
function Get_KeyPreview: WordBool; safecall;
function Get_PixelsPerInch: Integer; safecall;
function Get_PrintScale: TxPrintScale; safecall;
function Get_Scaled: WordBool; safecall;
function Get_Visible: WordBool; safecall;
function Get_WindowState: TxWindowState; safecall;
procedure Set_AutoScroll(Value: WordBool); safecall;
procedure Set_AxBorderStyle(Value: TxActiveFormBorderStyle); safecall;
procedure Set_Caption(const Value: WideString); safecall;
procedure Set_Color(Value: TColor); safecall;
procedure Set_Cursor(Value: Smallint); safecall;
procedure Set_DropTarget(Value: WordBool); safecall;
procedure Set_Enabled(Value: WordBool); safecall;
procedure Set_Font(const Value: Font); safecall;
procedure Set_HelpFile(const Value: WideString); safecall;
procedure Set_KeyPreview(Value: WordBool); safecall;
procedure Set_PixelsPerInch(Value: Integer); safecall;
procedure Set_PrintScale(Value: TxPrintScale); safecall;
procedure Set_Scaled(Value: WordBool); safecall;
procedure Set_Visible(Value: WordBool); safecall;
procedure Set_WindowState(Value: TxWindowState); safecall;
function Get_Search: WideString; safecall;
procedure Set_Search(const Value: WideString); safecall;
function FindEmployee(EmpNo: Integer): WordBool; safecall;
procedure ShowSearchControls(Value : WordBool); safecall;
public
{ Public declarations }
end;
implementation
uses ComServ;
{$R *.DFM}
{ TAFEmployee }
procedure TAFEmployee.EventSinkChanged(const EventSink: IUnknown);
begin
FEvents := EventSink as IAFEmployeeEvents;
end;
procedure TAFEmployee.Initialize;
begin
OnActivate := ActivateEvent;
OnClick := ClickEvent;
OnCreate := CreateEvent;
OnDblClick := DblClickEvent;
OnDeactivate := DeactivateEvent;
OnDestroy := DestroyEvent;
OnKeyPress := KeyPressEvent;
OnPaint := PaintEvent;
end;
function TAFEmployee.Get_Active: WordBool;
begin
Result := Active;
end;
function TAFEmployee.Get_AutoScroll: WordBool;
begin
Result := AutoScroll;
end;
function TAFEmployee.Get_AxBorderStyle: TxActiveFormBorderStyle;
begin
Result := Ord(AxBorderStyle);
end;
function TAFEmployee.Get_Caption: WideString;
begin
Result := WideString(Caption);
end;
function TAFEmployee.Get_Color: TColor;
begin
Result := Color;
end;
function TAFEmployee.Get_Cursor: Smallint;
begin
Result := Smallint(Cursor);
end;
function TAFEmployee.Get_DropTarget: WordBool;
begin
Result := DropTarget;
end;
function TAFEmployee.Get_Enabled: WordBool;
begin
Result := Enabled;
end;
function TAFEmployee.Get_Font: Font;
begin
GetOleFont(Font, Result);
end;
function TAFEmployee.Get_HelpFile: WideString;
begin
Result := WideString(HelpFile);
end;
function TAFEmployee.Get_KeyPreview: WordBool;
begin
Result := KeyPreview;
end;
function TAFEmployee.Get_PixelsPerInch: Integer;
begin
Result := PixelsPerInch;
end;
function TAFEmployee.Get_PrintScale: TxPrintScale;
begin
Result := Ord(PrintScale);
end;
function TAFEmployee.Get_Scaled: WordBool;
begin
Result := Scaled;
end;
function TAFEmployee.Get_Visible: WordBool;
begin
Result := Visible;
end;
function TAFEmployee.Get_WindowState: TxWindowState;
begin
Result := Ord(WindowState);
end;
procedure TAFEmployee.Set_AutoScroll(Value: WordBool);
begin
AutoScroll := Value;
end;
procedure TAFEmployee.Set_AxBorderStyle(Value: TxActiveFormBorderStyle);
begin
AxBorderStyle := TActiveFormBorderStyle(Value);
end;
procedure TAFEmployee.Set_Caption(const Value: WideString);
begin
Caption := TCaption(Value);
end;
procedure TAFEmployee.Set_Color(Value: TColor);
begin
Color := Value;
end;
procedure TAFEmployee.Set_Cursor(Value: Smallint);
begin
Cursor := TCursor(Value);
end;
procedure TAFEmployee.Set_DropTarget(Value: WordBool);
begin
DropTarget := Value;
end;
procedure TAFEmployee.Set_Enabled(Value: WordBool);
begin
Enabled := Value;
end;
procedure TAFEmployee.Set_Font(const Value: Font);
begin
SetOleFont(Font, Value);
end;
procedure TAFEmployee.Set_HelpFile(const Value: WideString);
begin
HelpFile := String(Value);
end;
procedure TAFEmployee.Set_KeyPreview(Value: WordBool);
begin
KeyPreview := Value;
end;
procedure TAFEmployee.Set_PixelsPerInch(Value: Integer);
begin
PixelsPerInch := Value;
end;
procedure TAFEmployee.Set_PrintScale(Value: TxPrintScale);
begin
PrintScale := TPrintScale(Value);
end;
procedure TAFEmployee.Set_Scaled(Value: WordBool);
begin
Scaled := Value;
end;
procedure TAFEmployee.Set_Visible(Value: WordBool);
begin
Visible := Value;
end;
procedure TAFEmployee.Set_WindowState(Value: TxWindowState);
begin
WindowState := TWindowState(Value);
end;
procedure TAFEmployee.ActivateEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnActivate;
end;
procedure TAFEmployee.ClickEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnClick;
end;
procedure TAFEmployee.CreateEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnCreate;
end;
procedure TAFEmployee.DblClickEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnDblClick;
end;
procedure TAFEmployee.DeactivateEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnDeactivate;
end;
procedure TAFEmployee.DestroyEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnDestroy;
end;
procedure TAFEmployee.KeyPressEvent(Sender: TObject; var Key: Char);
var
TempKey: Smallint;
begin
TempKey := Smallint(Key);
if FEvents <> nil then FEvents.OnKeyPress(TempKey);
Key := Char(TempKey);
end;
procedure TAFEmployee.PaintEvent(Sender: TObject);
begin
if FEvents <> nil then FEvents.OnPaint;
end;
procedure TAFEmployee.btnSearchClick(Sender: TObject);
begin
if edSearch.Text<>'' then begin
tblEmployee.FindKey([edSearch.Text]);
end;
end;
function TAFEmployee.Get_Search: WideString;
begin
Result:=edSearch.Text;
end;
procedure TAFEmployee.Set_Search(const Value: WideString);
begin
edSearch.Text:=Value;
end;
function TAFEmployee.FindEmployee(EmpNo: Integer): WordBool;
begin
Result:=tblEmployee.FindKey([edSearch.Text]);
end;
procedure TAFEmployee.ShowSearchControls(Value : WordBool);
begin
lblSearch.Visible:=Value;
edSearch.Visible:=Value;
btnSearch.Visible:=Value;
end;
initialization
TActiveFormFact